package com.guangaiboen.attendance.wx.web;

import com.guangaiboen.attendance.core.util.ResponseUtil;
import com.guangaiboen.attendance.db.domain.AttendanceDept;
import com.guangaiboen.attendance.db.domain.resp.AttendanceInfoResp;
import com.guangaiboen.attendance.db.service.AttendanceDeptService;
import com.guangaiboen.attendance.db.service.AttendanceInfoService;
import com.guangaiboen.attendance.wx.annotation.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 部门管理
 */
@RestController
@RequestMapping("/wx/dept")
@Validated
public class WxAttendanceDeptController {
    @Autowired
    private AttendanceDeptService deptService;




    @GetMapping("deptList")
    public Object deptList(@LoginUser Integer userId) {
        //当前用户没登录，提示未登录，不允许查询部门列表列表信息
        if (userId == null) {
            return ResponseUtil.unlogin();
        }
        List<AttendanceDept> resultList = deptService.deptList();
        return ResponseUtil.okList(resultList);
    }


}
